package com.noahplat.person.pojo;


import lombok.Data;
import org.hibernate.validator.constraints.Length;
import tk.mybatis.mapper.annotation.KeySql;

import javax.persistence.Column;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.util.Date;

/**
 * 功能：人员信息实体类
 * name:宋彦磊
 * time:2021.02.28
 */

@Data
@Table(name = "tb_person_base")
public class PersonBase implements Serializable {
    @Id
    @KeySql(useGeneratedKeys = true)
    private Long id;   //主键ID
    private Long pid;  //人员ID

    @NotNull(message = "性别不能为空")
    @Length(max = 1)
    private String sex; //性别 0:男 1:女

    private Date birthday; //出生日期

    @NotNull(message = "身高不能为空")
    @Length(max = 8)
    private String height;  //身高单位cm

    @NotNull(message = "体重不能为空")
    @Length(max = 8)
    private String weight;  //体重单位kg

    @NotNull(message = "ABO血型不能为空")
    @Length(max = 10)
    private String abotype;  //ABO血型

    @NotNull(message = "RH血型不能为空")
    @Length(max = 10)
    private String rhtype;  //RH血型

    /**
     * 无参构造
     */
    public PersonBase() {
    }

    /**
     * 有参构造
     * @param pid
     * @param sex
     * @param birthday
     * @param height
     * @param weight
     * @param abotype
     * @param rhtype
     */
    public PersonBase(Long pid, @NotNull(message = "参数不能为null") @Length(max = 1) String sex, @NotNull(message = "参数不能为null") Date birthday, @NotNull(message = "参数不能为null") @Length(max = 8) String height, @NotNull(message = "参数不能为null") @Length(max = 8) String weight, @NotNull(message = "参数不能为null") @Length(max = 10) String abotype, @NotNull(message = "参数不能为null") @Length(max = 10) String rhtype) {
        this.pid = pid;
        this.sex = sex;
        this.birthday = birthday;
        this.height = height;
        this.weight = weight;
        this.abotype = abotype;
        this.rhtype = rhtype;
    }
}
